{% extends "SisGGFinalBundle:Usuario:user.html.twig" %}
{% block title %}Clientes{% endblock %}
{% block name %}Kito's Local{% endblock%}
{% block descripcion %}Lorem ipsum ad his scripta blandit partiendo, eum fastidii accumsan euripidis in, eum liber hendrerit an. Qui ut wisi vocibus suscipiantur, quo dicit ridens inciderint id. Quo mundi lobortis reformidans eu, legimus senserit definiebas an eos. Eu sit tincidunt incorrupte definitionem, vis mutat affert percipit cu, eirmod consectetuer signiferumque eu per. In usu latine equidem dolores. Quo no falli viris intellegam, ut fugit veritus placerat per.{% endblock%}
{% block content %}
        <legend>Clientes</legend>      
        <form method="post" action="{{path('clientes')}}">
            <div class="input-append search-query">
                <button type="submit" class="btn pull-right"><i class="icon-search"></i></button>
                <input type="text" name="busqueda" class="pull-right" value="{{busqueda}}">
                <select name="criterio" class="pull-right">
                    <option value="Todos">Todos</option>
                    <option {%if criterio == 'dni' %} selected="true"{%endif%} value="dni">Dni</option>
                    <option {%if criterio == 'apellido' %} selected="true"{%endif%} value="apellido">Apellido</option>
                    <option {%if criterio == 'telefono' %} selected="true"{%endif%} value="telefono">Telefono</option>
                    <option {%if criterio == 'celular' %} selected="true"{%endif%} value="celular">Celular</option>
                </select>
            </div>
        </form>
        <table class="table table-hover" style="height: 20px;overflow-style: scrollbar">
            <thead class="header">
            <tr>
                <th>Dni</th>
                <th>Apellido</th>
                <th>Nombre</th>
                <th>Direccion</th>
                <th>Telefono</th>
                <th>Celular</th>
                <th colspan="3">Acciones</th>
            </tr>
            </thead>
            {% for cliente in clientes%}
             <tr>
                <td>{{cliente.dni}}</td>
                <td>{{cliente.apellido}}</td>
                <td>{{cliente.nombre}}</td>
                <td>{{cliente.direccion}}</td>
                <td>{{cliente.telefonofijo}}</td>
                <td>{{cliente.telefonocelular}}</td>
                <div id="{{cliente.id}}" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none; ">
                    <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                        <h3 id="myModalLabel">Eliminar Cliente</h3>
                    </div>
                    <div class="modal-body">
                        <p>¿Esta seguro que desea eliminar el cliente: {{cliente.apellido}}, {{cliente.nombre}}?</p>
                    </div>
                    <div class="modal-footer">
                        <button class="btn" data-dismiss="modal">Cancelar</button>
                        <a class="btn btn-primary" href="{{path('eliminar_cliente',{'id':cliente.id})}}">Eliminar Cliente</a>
                    </div>
                </div>
                <td><a rel="tooltip" title="Editar" href="{{path('editar_cliente',{'id':cliente.id})}}"><i class="icon-edit"></i></a></td>
                <td><a rel="tooltip" title="Eliminar" href="#{{cliente.id}}" data-toggle="modal"><i class="icon-remove"></i></a></td>
                {% if direccion != '' %}
                <td><a href="{{path(direccion,{'id':id,'cliente':cliente.id})}}"rel="tooltip" title="Seleccionar" ><i class="icon-ok"></i></a></td>
                {% endif %}
            </tr>   
            {% endfor %}
        </table>        
{% endblock %}